<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    #box1,#box2{
        width: 100px;
        height: 100px;
        background: red;
        margin: 50px;
    }
</style>
<body>
    <div id="box1"></div>
    <div id="box2"></div>
    <p>
        <button class="btn1">显示</button>
        <button class="btn2">隐藏</button>
    </p>
    <p>
        <button class="btn3">淡入</button>
        <button class="btn4">淡出</button>
    </p>
    <p>
        <button class="btn5">展开</button>
        <button class="btn6">折叠</button>
    </p>
</body>
<script src="../jquery-3.6.3.js"></script>
<script>
    $(".btn1").click(function(){
        $("#box1,#box2").show(1000)
    })
    $(".btn2").click(function(){
        $("#box1,#box2").hide(500)
    })
    $(".btn3").click(function(){
        $("#box1,#box2").fadeIn(400)
    })
    $(".btn4").click(function(){
        $("#box1,#box2").fadeOut(600)
    })
    $(".btn5").click(function(){
        $("#box1,#box2").slideDown(1500)
    })
    $(".btn6").click(function(){
        $("#box1,#box2").slideUp(1200)
    })
</script>
</html>